﻿Imports System.Configuration
Imports System.Data

Partial Class AMLO_genXML
    Inherits System.Web.UI.Page
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cls As clsDatabase = New clsDatabase


        ' cmd.CommandText() = "ASPAllianceArticles.Article643.OpenXmlFile"

        ' Dim param As New OracleParameter("p_dir_name", OracleDbType.Varchar2)
        ' param.Value = "C:\\xmldata"

        ' cmd.Parameters.Add(param)

        Try
            'cmd.ExecuteNonQuery()
            If (cls.QueryProcedureExecuteNonQuery("ADMIN.P101.OpenXmlFile", "p_dir_name", "C:\xmldata")) Then
                StatusLabel.Visible = True
                StatusLabel.Text = "XML Generation Successful"
                BindXmlDataGrid()
            Else
                StatusLabel.Visible = True
                StatusLabel.Text = "<b>ERROR</b>: " + "error"
            End If
        Catch ex As Exception
            StatusLabel.Text = ex.Message
        Finally
            ' dbConn.Dispose()
        End Try
    End Sub

    Private Sub BindXmlDataGrid()
        Dim myDataSet As New DataSet
        Try
            myDataSet.ReadXml("C:\\xmldata\\P101.xml")
            XmlDataGrid.DataSource = myDataSet
            XmlDataGrid.DataBind()
        Catch ex As Exception
            StatusLabel.Visible = True
            StatusLabel.Text = "<b>ERROR</b>: " + ex.Message.ToString()
        End Try
    End Sub
End Class
